package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import serivce.Adminserivce;
import untity.BriefHouse;
import untity.User;

import java.util.List;

@RestController
@RequestMapping("/admin")
public class Admin {

    @Autowired
    private Adminserivce adminserivce;
    @PostMapping("/user")
    public List<User> getallUser(){
        List<User> list=adminserivce.getAllUser();
        return list;
    }

    @PostMapping("/userDelete/{id}")
    public void userDelete(@PathVariable("id") String id){
        adminserivce.userDelete(id);
    }

    @PostMapping("/house")
    public List<BriefHouse> getAllHouse(){
        List<BriefHouse> list= adminserivce.getAllHouse();
        return list;
    }

    @PostMapping("/houseDetele/{id}")
    public void houseDelete(@PathVariable("id") String id){
        adminserivce.houseDelete(id);
    }


}
